
#ifndef __SCREEN_H__
#define __SCREEN_H__

#include <betty/terminal.h>



struct Screen {
	int			width;
	int			height;
	int			scrollback;

        struct Betty_Position   cursor;

        struct Betty_Line       *line;
        int     	        line_count;
        int                     line_top;

        /* user interface binding */
        void *ui;
        const struct Betty_UiOperations *ui_ops;
};


int screen_init (struct Screen *s, int width, int height, int scrollback);
void screen_cleanup (struct Screen *s);
void screen_set_ui (struct Screen *s, void *ui,
                                const struct Betty_UiOperations *ops);
int screen_resize (struct Screen *s, int width, int height, int scrollback);

void screen_shift_up (struct Screen *s, int count);
void screen_scroll_up (struct Screen *s, int top, int bottom, int count);
void screen_scroll_down (struct Screen *s, int top, int bottom, int count);
void screen_scroll_right (struct Screen *s, const struct Betty_Rect *r,
				int count);
void screen_scroll_left (struct Screen *s, const struct Betty_Rect *r,
				int count);

/* cursor control */
void screen_cursor_goto (struct Screen *s, int x, int y);

void screen_erase (struct Screen *s, const struct Betty_Rect *r);
void screen_bell (struct Screen *s);
void screen_fill_active_cell (struct Screen *s, 
				const struct Betty_CellAttribute *attr,
				Betty_Character uc);
void screen_fill (struct Screen *s, const struct Betty_Rect *rect,
		Betty_Character uc, const struct Betty_CellAttribute *attr);

/* content access */
struct Betty_Line * screen_line (struct Screen *s, int y);

#endif

